<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Attendance_model extends CI_Model
{
	
	public function __construct()
	{
		parent::__construct();

	} 	
	
	
  public function get_attendance_details($id)
  {	  
	  $user_id = array(
	  'user_id' => $id,
	  );
	  
 		return $query = $this->db->get_where('daily_attendance_sheet', $user_id)->result();
		
  }
  
  public function get_working_hr($user_id)
	{
		$check = array('user_id'=>$user_id);	
		$this->db->select('min_working_hour, per_day_salary ');
		$this->db->from('salary_account');
		$this->db->where($check);
		return $query = $this->db->get()->row_array();
	}
		
	public function get_details($id,$year_id,$month_id)
	{
		$serach = array(
		'year_id' =>$year_id,
		'month_id'=>$month_id,
		'user_id' => $id
		);
		
		return $this->db->get_where('daily_attendance_sheet',$serach)->result();
	}
	
	public function get_time($user_id,$year_id,$month_id,$date_id){
		
		$check = array('year_id' => $year_id, 'month_id' => $month_id, 'date_id' => $date_id,'user_id'=>$user_id,);
		$this->db->select('entry_time, exit_time');
		$this->db->from('attendance_timings');
		$this->db->where($check);
		return $query = $this->db->get()->row_array();
	}
	
}
